<template>
  <div class="card">
    <div class="img-container">
      <img width="50" height="50" :src="cardData.imgUrl" alt />
    </div>
    <div class="info">
      <h1 class="title">{{ cardData.title }}</h1>
      <p class="count">{{ cardData.count }}</p>
    </div>
  </div>
</template>

<script>
export default {
  // 设计参数
  props: {
    // 图片地址
    cardData: {
      type: Object,
      default: () => {
        return {};
      },
      required: true
    }
  }
};
</script>

<style lang="less" scoped>
.card {
  width: 100%;
  height: 80px;
  background-color: #fff;
  border-radius: 4px;
  box-shadow: 0px 0px 5px #ccc;
  display: flex;

  .img-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .info {
    flex: 2;
    display: flex;
    justify-content: center;
    flex-direction: column;
    align-items: center;

    .title {
      font-weight: 500;
      font-size: 16px;
      color: #ccc;
      line-height: 1.5;
    }

    .count {
      color: #333;
      font-weight: 500;
    }
  }
}

// 媒体查询
@media screen and (max-width: 890px) {
  .card {
    display: flex;
    flex-direction: column;
    .img-container {
      flex: 1;
      img {
        width: 30px;
        height: 30px;
      }
    }
    .info {
      flex: 1;
      .title {
        font-size: 12px;
      }
      .count {
        font-size: 12px;
      }
    }
  }
}
</style>